package com.clas.liu.myapplication.presenter.impl;

import android.os.Handler;
import android.os.Message;

import com.clas.liu.myapplication.model.event.InfoEvent;
import com.clas.liu.myapplication.model.impl.BaseModel;
import com.clas.liu.myapplication.model.impl.InfoModel;
import com.clas.liu.myapplication.presenter.i.IInfoPresenter;
import com.clas.liu.myapplication.view.activity.impl.BaseActivity;
import com.clas.liu.myapplication.view.activity.impl.InfoActivity;

/**
 * Created by liu on 2019/5/22.
 */

public class InfoPresenter extends BasePresenter<InfoActivity, InfoModel> implements IInfoPresenter {
    public InfoPresenter(InfoActivity view) {
        super(view);
    }

    @Override
    public void report(String info_id, String releaseTime) {
        mModel.report(info_id, releaseTime);
    }

    @Override
    protected InfoModel getModel(Handler handler) {
        return new InfoModel(handler);
    }

    @Override
    protected void eventReceive(Message msg) {
        switch (msg.what) {
            case InfoEvent.JUBAO_INFO_FAIL:
                mView.failBecauseNetReturn(msg.what);
                break;
            case InfoEvent.JUBAO_INFO_OK:
                mView.reportReturn();
                break;
        }
    }
}
